package o;

import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;

public class yd {
    private final List<d<?, ?>> ˋ = new ArrayList();

    static final class d<Z, R> {
        final yc<Z, R> ˊ;
        private final Class<R> ˋ;
        private final Class<Z> ˎ;

        d(@NonNull Class<Z> cls, @NonNull Class<R> cls2, @NonNull yc<Z, R> ycVar) {
            this.ˎ = cls;
            this.ˋ = cls2;
            this.ˊ = ycVar;
        }

        public boolean ˋ(@NonNull Class<?> cls, @NonNull Class<?> cls2) {
            return this.ˎ.isAssignableFrom(cls) && cls2.isAssignableFrom(this.ˋ);
        }
    }

    public synchronized <Z, R> void ˋ(@NonNull Class<Z> cls, @NonNull Class<R> cls2, @NonNull yc<Z, R> ycVar) {
        this.ˋ.add(new d(cls, cls2, ycVar));
    }

    @NonNull
    public synchronized <Z, R> yc<Z, R> ˋ(@NonNull Class<Z> cls, @NonNull Class<R> cls2) {
        yc<Z, R> ˋ;
        if (cls2.isAssignableFrom(cls)) {
            ˋ = yj.ˋ();
        } else {
            for (d dVar : this.ˋ) {
                if (dVar.ˋ(cls, cls2)) {
                    ˋ = dVar.ˊ;
                }
            }
            throw new IllegalArgumentException("No transcoder registered to transcode from " + cls + " to " + cls2);
        }
        return ˋ;
    }

    @NonNull
    public synchronized <Z, R> List<Class<R>> ॱ(@NonNull Class<Z> cls, @NonNull Class<R> cls2) {
        List<Class<R>> list;
        List<Class<R>> arrayList = new ArrayList();
        if (cls2.isAssignableFrom(cls)) {
            arrayList.add(cls2);
            list = arrayList;
        } else {
            for (d ˋ : this.ˋ) {
                if (ˋ.ˋ(cls, cls2)) {
                    arrayList.add(cls2);
                }
            }
            list = arrayList;
        }
        return list;
    }
}
